@import "./variables.scss";

//reset
* {
    box-sizing: border-box;
    outline: none;
}


a {
    color: #999;
    text-decoration: none;
}



@each $colorKey,
$color in $colors {
    .text-#{$colorKey} {
        color: $color;
    }

    .bg-#{$colorKey} {
        background-color: $color;
    }
}

//text
@each $var in (left, center, right) {
    .text-#{$var} {
        text-align: $var !important;
    }
}

//fontsize

//文本溢出
.text-ellipsis {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


@each $sizeKey,
$size in $font-sizes {
    .fs-#{$sizeKey} {
        font-size: $size * $base-font-size;
    }
}

//flex布局
.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}


@each $key,
$value in $flex-jc {
    .jc-#{$key} {
        justify-content: $value;
    }
}


@each $key,
$value in $flex-ai {
    .ai-#{$key} {
        align-items: $value;
    }
}

.flex-1 {
    flex: 1;
}

.flex-grow-1 {
    flex-grow: 1;
}



@each $typeKey,
$type in $spacing-types {

    //m-1
    @each $sizeKey,
    $size in $spacing-size {
        .#{$typeKey}-#{$sizeKey} {
            #{$type}: $size * $spacing-base-size;
        }
    }

    //mx-1
    @each $sizeKey,
    $size in $spacing-size {
        .#{$typeKey}x-#{$sizeKey} {
            #{$type}-left: $size * $spacing-base-size;
            #{$type}-right: $size * $spacing-base-size;
        }
    }

    //my-1
    @each $sizeKey,
    $size in $spacing-size {
        .#{$typeKey}y-#{$sizeKey} {
            #{$type}-top: $size * $spacing-base-size;
            #{$type}-bottom: $size * $spacing-base-size;
        }
    }


    //mt-1
    @each $directionKey,
    $direction in $spacing-direction {

        @each $sizeKey,
        $size in $spacing-size {
            .#{$typeKey}#{$directionKey}-#{$sizeKey} {
                #{$type}-#{$direction}: $size * $spacing-base-size;
            }
        }
    }
}

//button


// nav

.nav {
    display: flex;

    .nav-item {
        border-bottom: 3px solid transparent;
        padding-bottom: 0.2rem;

        // & 表示同级
        &.active {
            color: map-get($colors , "primary");
            border-bottom-color: map-get($colors , "primary");
        }
    }

    &.nav-inverse {
        .nav-item {
            color: map-get($colors, "white");

            &.active {
                border-bottom-color: map-get($colors , "white");
            }
        }
    }
}

//images
.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

//sprite

//boders
@each $dir in (top, right, bottom, left) {
    .border-#{$dir} {
        border-#{$dir}: 1px solid $border-color;
    }
}